<template>
  <el-container>
    <div :style="isCollapse ? 'width: 4.2%;' : 'width: 13%;'" class="aside-sidebar">
      <Sidebar></Sidebar>
    </div>
    <el-container>
      <el-header :style="isCollapse ? 'left: 4.2%;' : 'left: 13%;'" fixed ref="header"><Header></Header></el-header>
      <el-main :style="{left:isCollapse?'4.2%' : '13%',height:boxHeight}"><router-view :apprefs="$refs"/></el-main>
  </el-container>
</el-container>
</template>

<script>

import Header from '../components/public/Header';
import Sidebar from '../components/public/Sidebar'
import Bus from '../modules/bus'

export default {
  name: 'Index',
  components: {
    Header,
    Sidebar
  },
  data() {
    return {
      boxHeight: 0,
      isCollapse: false,
    }
  },
  created() {
    Bus.$on('isCollapse', (val, vall) => {
      this.isCollapse = val;
      console.log('第一个val参数：',val)
      console.log('第二个vall参数：',vall)
    })
  },
  mounted(){
    this.boxHeight = document.documentElement.clientHeight - 60 + 'px'
    console.log("主面板高度：",document.documentElement.clientHeight )
  }
}
</script>

<style>
.el-container{
  display: flex;
  -webkit-box-flex: 1;
  flex: 1;
  min-width: 0;
}
  
  .aside-sidebar {
    background-color: rgb(236, 236, 236);
    /* color: #333; */
    height: 100%;
    /* display: block; */
    /* position: fixed; */
    /* position: absolute; */
    position: fixed;
    max-height: 100%;
    /* width: 13%; */
    left: 0;
    top: 0;
    /* border-right: 1px solid #d3d3d3; */
    /* background: #fff; */
    z-index: 999;
  }

.el-header {
    background-color: rgba(250, 250, 250);
    color: #333;
    text-align: center;
    line-height: 60px;
    border-bottom: 1px solid #fff;
    /* position: relative; */
    /* left: 13%; */
    width: 100%;
    top: 0;
    position: fixed;
    /* background: #fff; */
    z-index: 998;
  }
  
  .el-main {
    background-color: rgba(236, 236, 236, 0.217);
    color: #333;
    position: relative;
    height: 100%;
    /* left: 13%; */
    top: 60px;
    width:87%;
    /* margin-left: 200px; */
  }
  
  

</style>